import type {PageParam, PageResult} from '@vben/request';
import type {Dayjs} from 'dayjs';

import {requestClient} from '#/api/request';
export namespace PerFamilyStockApi {
  /** 股票情况信息 */
  export interface FamilyStock {
    id: number; // 主键ID
    employeeId: number; // 人员ID，对应 per_employee.id
    relation: string; // 与本人关系（称谓）
    systemPersonId: number; // 系统人员ID，对应system_person.id
    familyName: string; // 姓名
    cardType: string; // 证件类型
    familyIdcard: string; // 家庭成员身份证号
    stockCode: string; // 股票代码
    stockName: string; // 股票名称
    shareQuantity: string; // 持股数量
    marketValue: number; // 填报前一交易日市值
    recordDate: string; // 记录时间
    status: number; // 是否有效（1：有效，0：无效）
  }
}

/** 查询股票情况分页 */
export function getFamilyStockPage(data: PageParam,desensitize: boolean,encrypt: boolean) {
  return requestClient.post<PageResult<PerFamilyStockApi.FamilyStock>>('/per/family-stock/page', data,{ desensitize,encrypt });
}

/** 查询股票情况详情 */
export function getFamilyStock(id: number) {
  return requestClient.get<PerFamilyStockApi.FamilyStock>(`/per/family-stock/get?id=${id}`);
}

/** 新增股票情况 */
export function createFamilyStock(data: PerFamilyStockApi.FamilyStock) {
  return requestClient.post('/per/family-stock/create', data);
}

/** 修改股票情况 */
export function updateFamilyStock(data: PerFamilyStockApi.FamilyStock) {
  return requestClient.put('/per/family-stock/update', data);
}

/** 删除股票情况 */
export function deleteFamilyStock(id: number) {
  return requestClient.delete(`/per/family-stock/delete?id=${id}`);
}

/** 批量删除股票情况 */
export function deleteFamilyStockList(ids: number[]) {
  return requestClient.delete(`/per/family-stock/delete-list?ids=${ids.join(',')}`)
}

/** 导出股票情况 */
export function exportFamilyStock(params: any) {
  return requestClient.download('/per/family-stock/export-excel', { params });
}
